﻿@using Snow.Template.ParameterManager.ParameterTypes.Dto
@model Snow.Template.Web.Models.Parameters.CreateOrEditParameterModalViewModel
<link href="~/lib/select2/dist/css/select2.css" rel="stylesheet" asp-append-version="true" />
<form id="modelForm" name="ParameterInformationsForm" role="form" novalidate>
    @if (Model.IsEditMode)
    {
        <input type="hidden" name="Id" value="@Model.Parameter.Id" />
    }
    @*<input asp-for="Parameter.ParameterTypeId" type="hidden" class="form-control">*@

    <div class="form-group">
        <label asp-for="Parameter.ParameterTypeId"></label>
        <select id="parameterType" name="Parameter.ParameterTypeId" class="form-control">
            <option></option>
            @foreach (ParameterTypeSelectListDto type in Model.ParameterTypes)
            {
                if (type.IsSelected)
                {
                    <option value="@type.Id" selected="selected">@type.Name</option>

                }
                else
                {
                    <option value="@type.Id">@type.Name</option>
                }
            }
        </select>
        <span asp-validation-for="Parameter.ParameterTypeId" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="Parameter.Value"></label>
        <input asp-for="Parameter.Value" type="text" class="form-control" placeholder="@Html.DisplayNameFor(model => model.Parameter.Value)">
        <span asp-validation-for="Parameter.Value" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="Parameter.Description"></label>
        <textarea asp-for="Parameter.Description" class="form-control" placeholder="@Html.DisplayNameFor(model => model.Parameter.Description)"></textarea>
        <span asp-validation-for="Parameter.Description" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="Parameter.Sort"></label>
        <input asp-for="Parameter.Sort" type="number" class="form-control" placeholder="@Html.DisplayNameFor(model => model.Parameter.Sort)">
        <span asp-validation-for="Parameter.Sort" class="text-danger"></span>
    </div>
</form>
<script src="~/lib/select2/dist/js/select2.js" asp-append-version="true"></script>
<script src="~/view-resources/Views/Parameters/_CreateOrEditModal.js" asp-append-version="true"></script>
<script type="text/javascript">
    $.validator.unobtrusive.parse('form');
</script>